/*
 * ============================================================================
 * Copyright Notice!
 * ----------------------------------------------------------------------------
 * This file contains proprietary and confidential information belonging to the
 * group of people involvled in developing this project.  Reproduction, disclosure 
 * or use without specific written authorization from project stake holders is 
 * prohibited. Please refer the readme.txt in project installation folder for more
 * specific contacts
 *
 * All rights reserved.
 * ============================================================================
 */
package edu.uwm.universitydb.service.dept;

import java.util.List;

import edu.uwm.universitydb.dao.dept.FetchDepartmentListCommand;
import edu.uwm.universitydb.dao.dept.SearchDepartmentByID;
import edu.uwm.universitydb.framework.exception.DataAccessException;
import edu.uwm.universitydb.model.Department;

/**
 * TODO Add a description of <code>DepartmentServiceImpl</type> here
 * 
 * @author Shyam Nair
 */
public class DepartmentServiceImpl implements DepartmentService
{
    /*
     * (non-javadoc)
     * @see edu.uwm.cs757.service.dept.DepartmentService#getDepartments()
     */
    @Override
    public List<Department> getDepartments()
    {
        try
        {
            final FetchDepartmentListCommand fetchCommand = new FetchDepartmentListCommand();
            return fetchCommand.executeCommand();
        }
        catch (final DataAccessException e)
        {
            e.printStackTrace();
            return null;
        }
    }

	@Override
	public Department getDepartmentByID(int id) {
		try
        {
            final SearchDepartmentByID fetchCommand = new SearchDepartmentByID(id);
            return fetchCommand.executeCommand();
        }
        catch (final DataAccessException e)
        {
            e.printStackTrace();
            return null;
        }
	}

}
/*
 * ============================================================================
 * Change History
 * ----------------------------------------------------------------------------
 * Apr 9, 2014   Shyam Nair
 * File created
 * ----------------------------------------------------------------------------
 */